<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title>税金贷产品评估结果</title>
	<c:import url="header_evaluating.jsp"/>
</head>
<body>
<header class="customer-header-result">
    <%--<h3> 税金贷产品评估结果 <a href="" style="">完成</a></h3>--%>
</header>
<div class="result-content">
	<p class="base-topic-explain">根据客户的条件，满足以下${channelsCount}个渠道的要求，产品详情如下，请根据实际情况向客户推荐办理</p>
	<div class="result-content-tap">
		<c:forEach items="${channels}" var="key" varStatus="keyStatus">
			<span  class="t-tap <c:if test="${keyStatus.index==0}">nav-active</c:if>" data-id="${key.id}">${key.channelCode}</span>
		</c:forEach>
	</div>
	
	<div class="result-panel">
		<div class="page-tab-container">
		<div class="credit-list">
			<h3>产品信息：</h3>
			<ul id="productInfo">
			</ul>
		</div>
		<div class="credit-list">
			<h3>办理要求：</h3>
			<ul  id="dealInfo">
			</ul>
		</div>
	</div>
	</div>
</div>
<c:import url="footer_evaluating.jsp"/>
<script>
    $(function () {	
        setFontSize(375);
        $('.result-content-tap span').click(function(){
				$(this).addClass('nav-active');
				$(this).siblings('span').removeClass('nav-active');
            getChannelField();
        })
		//获取有nav-active的标签并获取关联字段
        getChannelField();

    })

	//查询渠道关联字段信息
	function getChannelField() {
        var channelId = "";
        $('.result-content-tap span').each(function () {
            if($(this).attr("class").indexOf("nav-active")>0){
                channelId = $(this).data("id");
            }
        });
        if(channelId != null && channelId != ""){
            $.ajax({
                url: sysInfo.basePath + '/api/evaluating/get_channel_field.do',
                type:'post',
                data:{channelId:channelId},
                dataType:'json',
                success:function(data){
                    if(data.code == 0){
                        var data = data.data;
                        if(data != null && data.length>0){
                            var productInfoHtml = "";
                            var dealInfoHtml = "";
                            for(key in data){
                                var fieldName = data[key].fieldName;
                                var fieldValue = data[key].fieldValue;
                                if(data[key].fieldType==1){
                                    productInfoHtml += "<li>"+fieldName+"： <span>"+fieldValue+"</span> </li>"
								}
                                if(data[key].fieldType==2){
                                    dealInfoHtml += "<li>"+fieldName+"： <span>"+fieldValue+"</span> </li>"
								}
							}
						}
						$("#productInfo").html("").append(productInfoHtml);
						$("#dealInfo").html("").append(dealInfoHtml);
                    }else{
                        console.log("获取数据失败")
                    }
                }
            });
		}
    }

</script>
</body>
</html>